Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style> </head> <body> <p>Click the button to return the innerHTML of the thead element.</p> <table id="myTable"> <thead> <tr> <th>Month</th> <th>Savings</th> </tr> </thead> <tfoot> <tr> <td>Sum</td> <td>$180</td> </tr> </tfoot> <tbody> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </tbody> </table><br> <button onclick="myFunction()">Try it</button> <script> function myFunction() { alert(document.getElementById("myTable").tHead.innerHTML); } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_table_thead by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:35:04 GMT --> </html>
Result:
Try it Yourself - © w3schools.com